#include <iostream>
// #include "ThreadPool_V1.hpp"
// #include "ThreadPool_V2.hpp"
// #include "ThreadPool_V3.hpp"
#include "ThreadPool_V4.hpp"
#include "Task.hpp"
#include <unistd.h>

//为了使用智能指针
#include <memory>

void test_class_task()
{

    
}


int main()
{
    // std::unique_ptr<ThreadPool<Task>> tp(new ThreadPool<Task>(20));
    // tp->init();
    // tp->start();

    printf("0x%x\n",ThreadPool<Task>::GetInstance());
    printf("0x%x\n",ThreadPool<Task>::GetInstance());
    printf("0x%x\n",ThreadPool<Task>::GetInstance());
    printf("0x%x\n",ThreadPool<Task>::GetInstance());
    printf("0x%x\n",ThreadPool<Task>::GetInstance());
    std::unique_ptr<ThreadPool<Task>> tp(ThreadPool<Task>::GetInstance());

    while (true)
    {
        int x, y;
        char op;
        std::cout << "please Enter x> ";
        std::cin >> x;
        std::cout << "please Enter y> ";
        std::cin >> y;
        std::cout << "please Enter op(+-*/)";
        std::cin >> op;

        Task t(x, y, op);

        tp->pushTask(t);
        sleep(1);
        // 充当生产者, 从网络中读取数据，构建成为任务，推送给线程池
    }

    return 0;
}